﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using Wisdom.Core.Specifications;

namespace Wisdom.Core.Repositories
{
    /// <summary>
    /// 仓库泛型接口.
    /// </summary>
    /// <typeparam name="TAggregateRoot">聚合根类型</typeparam>
    public interface IRepository<TAggregateRoot>
        where TAggregateRoot : class, IAggregateRoot
    {
        /// <summary>
        /// 获得仓库上下文
        /// </summary>
        IRepositoryContext Context { get; }
        /// <summary>
        /// 添加一个聚合根到仓库.
        /// </summary>
        /// <param name="aggregateRoot">聚合根.</param>
        void Add(TAggregateRoot aggregateRoot);
        /// <summary>
        /// 添加枚举聚合根到仓库.
        /// </summary>
        /// <param name="aggregateRoots">聚合根</param>
        void Add(IEnumerable<TAggregateRoot> aggregateRoots);
        /// <summary>
        /// 从仓库移出指定的聚合根.
        /// </summary>
        /// <param name="aggregateRoot">要移出的聚合根.</param>
        void Remove(TAggregateRoot aggregateRoot);
        /// <summary>
        /// 从仓库移出指定的枚举聚合根.
        /// </summary>
        /// <param name="aggregateRoots">要移出的聚合根.</param>
        void Remove(IEnumerable<TAggregateRoot> aggregateRoots);
        /// <summary>
        /// 从仓库移出所有符合给定的聚合根元素.
        /// </summary>
        /// <param name="specification">聚合根元素.</param>
        void Remove(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 从仓库移出所有符合委托表达式的聚合根.
        /// </summary>
        /// <param name="specExpression">符合委托表达式的聚合根.</param>
        void Remove(Expression<Func<TAggregateRoot, bool>> specExpression);
        /// <summary>
        /// 更新指定的聚合根.
        /// </summary>
        /// <param name="aggregateRoot">指定的聚合根.</param>
        void Update(TAggregateRoot aggregateRoot);
        /// <summary>
        /// 更新指定的枚举聚合根.
        /// </summary>
        /// <param name="aggregateRoots">可枚举聚合根.</param>
        void Update(IEnumerable<TAggregateRoot> aggregateRoots);
        /// <summary>
        /// 在仓库添加或更新指定的聚合根.
        /// </summary>
        /// <param name="aggregateRoot">添加或更新指定的聚合根.</param>
        void AddOrUpdate(TAggregateRoot aggregateRoot);
        /// <summary>
        /// 在仓库添加或更新指定的枚举聚合根.
        /// </summary>
        /// <param name="aggregateRoots">添加或更新指定的枚举聚合根.</param>
        void AddOrUpdate(IEnumerable<TAggregateRoot> aggregateRoots);
        /// <summary>
        /// 判断指定的枚举聚合根是否存在于仓库里.
        /// </summary>
        /// <param name="specification">匹配的枚举聚合根.</param>
        /// <returns>True 如果存在聚合根, 否则 false.</returns>
        bool Exists(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 判断指定的枚举聚合根委托是否存在于仓库里.
        /// </summary>
        /// <param name="specExpression">枚举聚合根委托.</param>
        /// <returns>True 如果存在聚合根, 否则 false.</returns>
        bool Exists(Expression<Func<TAggregateRoot, bool>> specExpression);

        #region Get Methods
        /// <summary>
        /// 通过指定的键获得聚合根.
        /// </summary>
        /// <param name="key">聚合根的键.</param>
        /// <returns>符合条件的聚合根.</returns>
        TAggregateRoot GetByKey(Guid key);
        /// <summary>
        /// 通过指定的聚合根规则获得一个符合条件的聚合根
        /// </summary>
        /// <param name="specification">聚合根规则</param>
        /// <returns>符合条件的聚合根.</returns>
        TAggregateRoot Get(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 通过指定的枚举聚合根规则获得一个符合条件的聚合根.
        /// </summary>
        /// <param name="specExpression">枚举聚合根规则.</param>
        /// <returns>符合条件的聚合根</returns>
        TAggregateRoot Get(Expression<Func<TAggregateRoot, bool>> specExpression);
        /// <summary>
        /// 通过指定的聚合根规则获得一个符合条件的聚合根
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="eagerLoadingProperties">聚合根表达式参数.</param>
        /// <returns>符合条件的聚合根.</returns>
        TAggregateRoot Get(ISpecification<TAggregateRoot> specification, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 通过指定的枚举聚合根表达式获得一个符合条件的聚合根.
        /// </summary>
        /// <param name="specExpression">枚举聚合根表达式.</param>
        /// <param name="eagerLoadingProperties">静态式聚合根参数.</param>
        /// <returns>符合条件的聚合根.</returns>
        TAggregateRoot Get(Expression<Func<TAggregateRoot, bool>> specExpression, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得仓库所有的聚合根.
        /// </summary>
        /// <returns>所有的聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll();
        /// <summary>
        /// 获得分页中指定页的所有聚合根
        /// </summary>
        /// <param name="pageNumber">页的索引号.</param>
        /// <param name="pageSize">每页显示大小.</param>
        /// <returns>指定页号，指定大小的所有聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(int pageNumber, int pageSize);
        /// <summary>
        /// 获得所有通过排序参数对枚举聚合根排序
        /// </summary>
        /// <param name="orderByParameters">参数 <see>
        ///                                       <cref>排序参数</cref>
        ///                                     </see> 排序聚合根参数.</param>
        /// <returns>所有通过排序参数对枚举聚合根排序</returns>
        IEnumerable<TAggregateRoot> GetAll(OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 通过获得分页获得页大小的聚合根，并排序
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">排序聚合根参数.</param>
        /// <returns>分页获得页大小的聚合根，并排序</returns>
        IEnumerable<TAggregateRoot> GetAll(int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 获得符合枚举聚合根规则所有聚合根.
        /// </summary>
        /// <param name="specification">枚举聚合根规则.</param>
        /// <returns>符合枚举聚合根规则所有聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 获得所有符合枚举聚合根表达式的聚合根元素.
        /// </summary>
        /// <param name="specExpression">枚举聚合根表达式.</param>
        /// <returns>所有符合枚举聚合根表达式的聚合根元素.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression);
        /// <summary>
        /// 获得符合聚合根规则，并在指定分页大小及页索引内的所有聚合根
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引.</param>
        /// <param name="pageSize">页大小.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize);
        /// <summary>
        ///  获得符合聚合根表达式，并在指定分页大小及页索引内的所有聚合根
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize);
        /// <summary>
        /// 获得符合聚合根规则并按排序参数排序后的所有聚合根
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="orderByParameters">聚合根排序参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 获得符合聚合根表达式并按排序参数排序后的所有聚合根
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="orderByParameters">聚合根排序参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 获得符合聚合根规则、并在指定的分页页码及页大小中并按排序参数排序后的所有聚合根
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">聚合根排序参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 获得符合聚合根表达式、并在指定的分页页码及页大小中并按排序参数排序后的所有聚合根
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">聚合根排序参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 获得所有的聚合根.
        /// </summary>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有分页中指定页大小和索引页的聚合根.
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="eagerLoadingProperties">聚合根表达式参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得根据聚合根表达式进行排序的所有聚合根.
        /// </summary>
        /// <param name="orderByParameters">聚合根排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根表达式参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得通过分页，排序的聚合根
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">排序数据.</param>
        /// <param name="eagerLoadingProperties">聚合根表达式参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根规则的聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根表达式的聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根规则并在指定分页页面的所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);

        /// <summary>
        /// 获得所有符合聚合根表达式并在指定分页页面的所有聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根.</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根规则聚合根
        /// </summary>
        /// <param name="specification">聚合根规则</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根表达式聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根规则并在分页数据页范围内的所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> GetAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 获得所有符合聚合根表达式并在分页数据页范围内的所有聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> GetAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        #endregion

        #region Find Methods
        /// <summary>
        /// 查找根据聚合根键查找聚合根.
        /// </summary>
        /// <param name="key">聚合根键.</param>
        /// <returns>聚合根.</returns>
        TAggregateRoot FindByKey(Guid key);
        /// <summary>
        /// 查找符合聚合根规则的所有聚合根.
        /// </summary>
        /// <param name="specification">匹配规则.</param>
        /// <returns>合聚合根规则的所有聚合根.</returns>
        TAggregateRoot Find(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 查找符合聚合根表达式的所有聚合根.
        /// </summary>
        /// <param name="specExpression">匹配表达式.</param>
        /// <returns>合聚合根表达式的所有聚合根</returns>
        TAggregateRoot Find(Expression<Func<TAggregateRoot, bool>> specExpression);
        /// <summary>
        /// 查找符合聚合根规则的所有聚合根
        /// </summary>
        /// <param name="specification">匹配规则.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根规则的所有聚合根.</returns>
        TAggregateRoot Find(ISpecification<TAggregateRoot> specification,  params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根表达式的所有聚合根
        /// </summary>
        /// <param name="specExpression">匹配表达式.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根表达式的所有聚合根.</returns>
        TAggregateRoot Find(Expression<Func<TAggregateRoot, bool>> specExpression,  params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找所有聚合根.
        /// </summary>
        /// <returns>所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll();
        /// <summary>
        /// 查找符合分页页面所有聚合根.
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <returns>符合聚合根分页的所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(int pageNumber, int pageSize);
        /// <summary>
        /// 查找所有聚合根并根据排序参数排序.
        /// </summary>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找符合分页页面所有聚合根并按排序参数排序.
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合聚合根分页的所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找符合聚合根规则的所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <returns>符合聚合根规则的所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification);
        /// <summary>
        /// 查找符合聚合根表达式的所有聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <returns>符合聚合根表达式的所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression);
        /// <summary>
        /// 查找符合聚合根规则并符合分页页面所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <returns>符合聚合根规则并符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize);
        /// <summary>
        /// 查找符合聚合根表达式并符合分页页面所有聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <returns>符合聚合根表达式并符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize);
        /// <summary>
        /// 查找符合聚合根规则所有聚合根并排序.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找符合聚合根表达式所有聚合根并排序.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找符合聚合根规则并符合分页页面所有聚合根,并排序.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找符合聚合根表达式并符合分页页面所有聚合根,并排序.
        /// </summary>
        /// <param name="specExpression">根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters);
        /// <summary>
        /// 查找所有聚合根.
        /// </summary>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合分页页面所有聚合根
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找所有聚合根并按排序参数排序
        /// </summary>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合分页页面所有聚合根,并排序.
        /// </summary>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根规则所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根规则所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根表达式所有聚合根
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根表达式所有聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根规则并符合分页页面所有聚合根.
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根规则并符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);

        /// <summary>
        /// 查找符合聚合根表达式并符合分页页面所有聚合根.
        /// </summary>
        /// <param name="specExpression">聚合根表达式</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合聚合根表达式并符合分页页面所有聚合根.</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根规则所有聚合根,并排序
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根表达式所有聚合根,并排序
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根规则并符合分页页面所有聚合根.并排序
        /// </summary>
        /// <param name="specification">聚合根规则.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(ISpecification<TAggregateRoot> specification, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        /// <summary>
        /// 查找符合聚合根表达式并符合分页页面所有聚合根.并排序.
        /// </summary>
        /// <param name="specExpression">聚合根表达式.</param>
        /// <param name="pageNumber">页索引号.</param>
        /// <param name="pageSize">页面大小.</param>
        /// <param name="orderByParameters">排序参数.</param>
        /// <param name="eagerLoadingProperties">聚合根参数.</param>
        /// <returns>符合条件聚合根</returns>
        IEnumerable<TAggregateRoot> FindAll(Expression<Func<TAggregateRoot, bool>> specExpression, int pageNumber, int pageSize, OrderByParameter<TAggregateRoot>[] orderByParameters, params Expression<Func<TAggregateRoot, dynamic>>[] eagerLoadingProperties);
        #endregion
    }
}
